package company_tencent.t;// 本题为考试多行输入输出规范示例，无需提交，不计分。

import java.util.Arrays;
import java.util.Scanner;

public class T2 {
    public static void main(String[] args) {
        // 贪心
        Scanner sc = new Scanner(System.in);
        int m = sc.nextInt();
        int n = sc.nextInt();
        int[] values = new int[n];
        int ans = 0;
        for (int i = 0; i < n; i++) {
            values[i] = sc.nextInt();
        }
        Arrays.sort(values);
        int range = 0;
        while (range < m) {
            int target = range + 1;
            int need = getMaxMinuxNum(values, target);
            if (need == 0) {
                System.out.println(-1);
                return;
            }
            ans++;
            range += need;
        }
        System.out.println(ans);
    }

    public static int getMaxMinuxNum(int[] values, int value) {
        int res = 0;
        for (int t : values) {
            if (t > value) {
                break;
            }
            res = t;
        }
        return res;
    }
}